<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/layouts/template.xhtml">
	<ui:define name="body">
		<h:form id="form" acceptcharset="ISO-8859-1">
			<f:metadata>
				<f:viewParam name="param" value="#{userBean.param}"/>
			</f:metadata>

			<p:panel header="#{msgs['massai.user.header.register']}">
				<h:panelGrid cellspacing="3" cellpadding="0">
					<h:panelGrid rendered="#{userBean.user.id ne null}">
						<h:outputLabel value="#{msgs['massai.user.status']}" for="status" />
						<p:selectOneMenu tabindex="1" value="#{userBean.user.active}" id="status"
							style="width: 100px;" label="#{msgs['massai.user.status']}">
							<f:selectItems value="#{userBean.statusUser()}" />
						</p:selectOneMenu>
					</h:panelGrid>

					<h:panelGrid>
						<p:outputLabel for="username" value="#{msgs['massai.user.login']}" />
						<p:inputText id="username" tabindex="2" value="#{userBean.user.username}" 
							style="width: 150px;" maxlength="20" disabled="#{userBean.user.id ne null}" 
							required="true" requiredMessage="Login #{msgs['common.required.field']}" />
					</h:panelGrid>

					<h:panelGrid>
						<p:outputLabel value="#{msgs['massai.user.name']}" for="name" />
						<p:inputText id="name" style="width: 350px;" tabindex="3" required="true" 
							requiredMessage="Nome #{msgs['common.required.field']}" 
							value="#{userBean.user.nameCollaborator}" maxlength="100" />
					</h:panelGrid>

					<h:panelGrid>
						<p:outputLabel value="#{msgs['massai.user.email']}" for="email" />
						<p:inputText id="email" style="width: 350px;" tabindex="4"
							required="true" requiredMessage="E-mail #{msgs['common.required.field']}"
							value="#{userBean.user.email}" maxlength="50" />
					</h:panelGrid>
				</h:panelGrid>

				<p:spacer height="25px" />

				<h:panelGrid style="width: 100%;">
					<h:panelGrid style="float: right;" columns="2">
						<p:commandButton value="#{msgs['common.back']}" style="padding: 1px !important;"
							action="userConsult" ajax="false" immediate="true" tabindex="5" />

						<p:commandButton tabindex="6" value="#{msgs['common.save']}"
							actionListener="#{userBean.save()}" ajax="false" 
							style="margin-right: 5px;" styleClass="buttonSave" update=":form" />
					</h:panelGrid>
				</h:panelGrid>
			</p:panel>
		</h:form>
	</ui:define>
</ui:composition>
</html>